import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false

import uView from "uview-ui";
Vue.use(uView);

// 多语言
import i18n from '@/utils/lang.js';

//注册tabbar组件
import comtabbar from "@/components/com-tabbar/index.vue"
Vue.component('com-tabbar', comtabbar)
//注册login组件
import comlogin from "@/components/com-login/com-login.vue"
Vue.component('com-login', comlogin)
//注册定位组件
import commap from "@/components/com-map/com-map.vue"
Vue.component('com-map', commap)
// 引入 store 
import store from '@/store/index.js'
Vue.prototype.$store = store

// 引入 mixin
import share from '@/mixins/share.js';
import scanCode from '@/mixins/scanCode.js';

Vue.mixin(share);
Vue.mixin(scanCode);

import { createRequestPermissionListener } from '@/uni_modules/x-perm-apply-instr-v2/js_sdk/index.js'
createRequestPermissionListener()

App.mpType = 'app'
const app = new Vue({
	...App,
	store,
	i18n
})

// http拦截器，此为需要加入的内容，如果不是写在common目录，请自行修改引入路径
import httpInterceptor from '@/common/http.interceptor.js'
// 这里需要写在最后，是为了等Vue创建对象完成，引入"app"对象(也即页面的"this"实例)
Vue.use(httpInterceptor, app)

// http接口API集中管理引入部分
import httpApi from '@/common/http.api.js'
Vue.prototype.$http_api = httpApi

app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif